package com.example.designmode.facade


/**
 * 职能家具外观类
 *
 * @author zhouronghua
 * @time 2022/3/10 2:57 下午
 */
class SmartAppliancesFacade constructor(
    val light: Light = Light(),
    val tv: TV = TV(),
    val airCondition: AirCondition = AirCondition()
) {

    fun sayHello(command: String) {
        if ("开启".equals(command)) {
            on()
        } else if ("关闭".equals(command)) {
            off()
        }
    }

    fun on() {
        light.on()
        tv.on()
        airCondition.on()
    }

    fun off() {
        light.off()
        tv.off()
        airCondition.off()
    }
}